<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="../css/reset.css"/>
		<link rel="stylesheet" type="text/css" href="../css/iconfont.css"/>
		<link rel="stylesheet" type="text/css" href="../css/mycomments.css"/>
	<script type="text/javascript" src="../js/jquery-2.0.3.js"></script>
	<script type="text/javascript" src="../js/rem.js"></script>
		<script type="text/javascript">
			$(window).load(function() {
				$('#box').delay(300).show()
			})
		</script>
	</head>
	<body>
		<!--页面加载 开始-->
		  <!--<div id="preloader">
		    <div id="status">
		      <p class="center-text"><span>拼命加载中···</span></p>
		    </div>
		  </div>-->
		  <!--页面加载 结束--> 
		<div id="box">
			<!--头部-->
			<header class="mycomments-top">
				<i onclick="goBack()" class="iconfont">&#xe621;</i>
				<h2>我的评论</h2>
				<p class="mycomments-delect">编辑</p>
			</header>
			<!--内容区-->
		
		<section class="mycomments-cont">
			<ul class="mycomments-content">
					<!--<li class="mycomments-content-first clear">
						<img class="mycomments-content-img"  src="../img/images/circle_07.jpg"/>
						<div class="mycomments-first-cont clear">
							<div class="mycomments-content-left">
								<p>VP战队重回世界之巅全程回顾</p>
								<p>13:22</p>
								<p>全民直播平台绝对是一部好片！！</p>
							</div>
							<div class="mycomments-content-right">
								<div class="mycomments-content-cont">
									<i class="iconfont mycomments-zan">&#xe606;</i>
									<span class="mycomments-total">5</span>
								</div>
								<i class="iconfont special ">&#xe62d;</i>
								<i class="iconfont mycomments-content-delect">&#xe62e;</i>
							</div>
						</div>
					</li>
					<li>
						<img class="mycomments-content-img" src="../img/images/circle_07.jpg"/>
						<div class="mycomments-first-cont clear">
							<div class="mycomments-content-left">
								<p>VP战队重回世界之巅全程回顾</p>
								<p>13:22</p>
								<p>全民直播平台绝对是一部好片！！</p>
							</div>
							<div class="mycomments-content-right">
								<div class="mycomments-content-cont">
									<i class="iconfont mycomments-zan">&#xe606;</i>
									<span class="mycomments-total">5</span>
								</div>
								<i class="iconfont special ">&#xe62d;</i>
								<i class="iconfont mycomments-content-delect">&#xe62e;</i>
							</div>
						</div>
						
					</li>
					<li>
						<img class="mycomments-content-img" src="../img/images/circle_07.jpg"/>
						<div class="mycomments-first-cont clear">
							<div class="mycomments-content-left">
								<p>VP战队重回世界之巅全程回顾</p>
								<p>13:22</p>
								<p>全民直播平台绝对是一部好片！！</p>
							</div>
							<div class="mycomments-content-right">
								<div class="mycomments-content-cont">
									<i class="iconfont mycomments-zan">&#xe606;</i>
									<span class="mycomments-total">5</span>
								</div>
								<i class="iconfont special ">&#xe62d;</i>
								<i class="iconfont mycomments-content-delect">&#xe62e;</i>
							</div>
						</div>
						
					</li>-->
			 </ul>
			<div class="mycomments-content-foot">
				无更多内容
			</div>
		</section>
		</div>
	</body>
	<script type="text/javascript" src="../js/reset.js"></script>
	<script type="text/javascript" src="../js/jquery-2.0.3.js"></script>
	<script type="text/javascript" src="../js/iscroll.js"></script>
	<script type="text/javascript">
			var num=0; 
			/*$('.mycomments-delect').click(function(e){ 
			if(num++ %2 == 0){ 
			$('.special').hide()
			$('.mycomments-content-delect').show()
			 $('.mycomments-content-delect').on('click',function(){
			   $(this).parent().parent().parent().remove()  
		     })
			}else{ 
			$('.special').show()
			$('.mycomments-content-delect').hide()
			} 
			e.preventDefault(); //阻止元素的默认动作（如果存在） 
			}); */
			
			 //点赞效果的实现
           $('.mycomments-zan').one('click',function(){
           	 var zan=$(this).siblings('.mycomments-total').html()
           	  zan++
           	  $(this).siblings('.mycomments-total').html(zan)
           	  $(this).html('&#xe600;')
           })
          
           
		/*评论列表*/
	   var b=localStorage.getItem("user_id")
	   console.log(b)
		$.ajax({
            type: 'POST',
            url: 'http://192.168.199.114:8080/HJF/user/get_user_comment_list.do',
            dataType: 'JSON',
            data:{user_id:b},
            success: function(data){
            	console.log(data)
            	$.each(data.data.comment_list,function(index){
            		var oDiv=$('<li class="mycomments-content-first clear">'+
						'<img class="mycomments-content-img"  src="'+data.data.comment_list[index].user_head_img_url+'"/>'+
						'<div class="mycomments-first-cont clear">'+
							'<div class="mycomments-content-left">'+
								'<p>'+data.data.comment_list[index].video_title+'</p>'+
								'<p>'+data.data.comment_list[index].comment_time+'</p>'+
								'<p>'+data.data.comment_list[index].comment_content+'</p>'+
							'</div>'+
							'<div class="mycomments-content-right">'+
								'<div class="mycomments-content-cont">'+
									'<i class="iconfont mycomments-zan">&#xe603;</i>'+
									'<span class="mycomments-total">'+data.data.comment_list[index].comment_laud_num+'</span>'+
								'</div>'+
								'<i class="iconfont special ">&#xe62d;</i>'+
								'<i class="iconfont mycomments-content-delect">&#xe62e;</i>'+
							'</div>'+
						'</div>'+
					'</li>')
            	$('.mycomments-content').append(oDiv)
            	$('.special').on('click',function(){
            	   var _this=$(this).parent().parent().parent().index()
            	   	localStorage.setItem('video_id',data.data.comment_list[_this].video_id)
            	   	window.location.href="detail.html"
            	})
            	})
            	  /*删除评论*/
		           $('.mycomments-delect').click(function(e){ 
					if(num++ %2 == 0){ 
					 $('.special').hide()
					 $('.mycomments-content-delect').show()
					 $('.mycomments-content-delect').on('click',function(){
					     var _this=$(this).parent().parent().parent().index()
					     console.log(_this)
					     var commentid=data.data.comment_list[_this].comment_id
					     console.log(commentid)
					      $(this).parent().parent().parent().remove()
						 	$.ajax({
					            type: 'POST',
					            url: 'http://192.168.199.114:8080/HJF/user/delete_user_comment.do',
					            dataType: 'JSON',
					            data:{user_id:b,comment_id:commentid},
					            success: function(data){ 
					             console.log(data)
					            },
					            error: function(xhr, type){
					                alert('Ajax error!');
					            }
					       });
				     })
				     }else{ 
					$('.special').show()
					$('.mycomments-content-delect').hide()
					} 
					e.preventDefault(); //阻止元素的默认动作（如果存在） 
				});
            },
            error: function(xhr, type){
                alert('Ajax error!');
            }
        });
	</script>
</html>
